import { Modifier } from "../../base/Modifier";
import { VisibleType } from "../../entity/Enum";

export class VisibilityModifier extends Modifier {
    static identity = Symbol("visibility");

    applyPeer(node: any, jsValue: any) {
        //通用检查入参格式是否为对象。   
        let visible = 0;
        if (jsValue === null || jsValue === undefined) {
            // undefined value use default value.
            visible = 0;
        } else if (typeof jsValue !== "number") {
            console.log("SetVisibility: The first param type is not number, invalid.");
            return;
        } else if (jsValue in VisibleType) {
            visible = jsValue;
        }
        else {
            console.log("SetVisibility: The first param type is a visibility value.");
            return;
        }

        // Call ViewAbstractModel's SetVisibility without callback
        // ViewAbstractModel.GetInstance().SetVisibility(visible, () => { });

    }
} 